Skip to content

Conversation

@basnijholt
Copy link
Owner

Summary

  • Automatically trims trailing whitespace from all output lines in generated markdown
  • Removes trailing empty lines from output blocks while preserving internal empty lines
  • Ensures cleaner, more consistent output formatting

Changes

  • Modified execute_code() to strip trailing newlines before splitting output
  • Updated _process_output_start() to trim trailing whitespace from each line and remove trailing empty lines
  • Added comprehensive pytest tests covering Python, Bash, and hidden code blocks

Test plan

  • Added unit tests for Python code blocks with trailing whitespace
  • Added unit tests for Bash code blocks with trailing whitespace
  • Added unit tests for hidden code blocks with trailing whitespace
  • Verified that internal empty lines are preserved for proper formatting
  • Confirmed trailing empty lines are removed from output blocks
  • All existing tests pass

- Strip trailing whitespace from each output line using rstrip()
- Preserve all empty lines (including trailing ones)
- Add comprehensive pytest tests for Python, Bash, and hidden code blocks
- Ensures cleaner output formatting while maintaining structure
@basnijholt basnijholt merged commit 215c734 into main Aug 23, 2025
12 checks passed
@basnijholt basnijholt deleted the trailing branch August 23, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants